package com.jblog.core;

import com.jblog.core.model.common.Status;

/**
 * Coreutil.java
 *
 * create at 09/01/2011 14:04:15
 */
public final class CoreUtil {

    private CoreUtil() {
    }
    
    /**
     * if status=normal and able=true | status=cancel and able=false, no need update
     */
    public static boolean checkStatus(final Status status, final boolean able) {
        return (status == Status.NORMAL && able)
                || (status == Status.CANCEL && !able);
    }
    /**
     * if able=true then status=normal else status=cancel
     */
    public static Status toStatus(final boolean able) {
        return able ? Status.NORMAL : Status.CANCEL;
    }
}
